package com.bitoon.basketdudes.web.jpa;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author paco
 */

@Entity
@Table(name = "carta_uniforme", schema = "basket")
@NamedQueries({
    @NamedQuery(name = "CartaUniforme.findAll"          , query = "SELECT c FROM CartaUniforme c order by Carta.id,c.camiseta,c.pantalon"),
    @NamedQuery(name = "CartaUniforme.findCombinacion"  , query = "SELECT c FROM CartaUniforme c where Carta.id = :carta_id and c.camiseta= :camiseta and c.pantalon= :pantalon")}
)

public class CartaUniforme {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
/*    @Basic(optional = false)
    @Column(name = "carta_id")
    private int carta_id;
 *
 */
    @Basic(optional = false)
    @Column(name = "camiseta")
    private int camiseta;
    @Basic(optional = false)
    @Column(name = "pantalon")
    private int pantalon;


    @JoinColumn(name = "carta_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Carta Carta;

    public CartaUniforme() {
    }

    public CartaUniforme(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getCamiseta() {
        return camiseta;
    }

    public void setCamiseta(int camiseta) {
        this.camiseta = camiseta;
    }

    public int getPantalon() {
        return camiseta;
    }

    public void setPantalon(int valor) {
        this.pantalon = valor;
    }

    public Carta getCarta() {
        return Carta;
    }

    public void setCarta(Carta Carta) {
        this.Carta = Carta;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CartaUniforme)) {
            return false;
        }
        CartaUniforme other = (CartaUniforme) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.Carta[id=" + id + "]";
    }

}
